using UnityEngine;


public class Movement : MonoBehaviour
{
    public CharacterController controller;
    public Animator animatior;

    [Header("Arrow")]
    public GameObject HandArrow;

    [Header("Camera Player Syncing")]
    public float lookDIstance = 5;
    public float lookSpeed = 5;
    public Transform camCenter;
    
    void Start()
    {
        HandArrow.gameObject.SetActive(false);
    }

    void HandArrowActive()
    {
        HandArrow.gameObject.SetActive(true);
    }

    // Update is called once per frame
    void LateUpdate()
    {
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");

        animatior.SetFloat("forward", x);
        animatior.SetFloat("strafe", z);

        if(Input.GetKey(KeyCode.LeftShift)&& z >0.1f)
        {
            animatior.SetBool("run", true);
        }

        if (Input.GetKey(KeyCode.LeftShift))
        {
            animatior.SetBool("run", true);
        }
        else
        {
            animatior.SetBool("run", false);
        }

        if (Input.GetButton("Fire1"))
        {
            animatior.SetBool("aim", true);
        }
        if(Input.GetButtonUp("Fire1"))
        {
            animatior.SetBool("aim", false);
            animatior.SetBool("shoot", true);
        }
        else
        {
            animatior.SetBool("shoot", false);
        }

    }
}
